namespace FaultDiagnosisSystem.Models.DataModels
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class WindTurbineDBContext : DbContext
    {
        public WindTurbineDBContext()
            : base("name=WindTurbineDBConnection")
        {
        }

        public virtual DbSet<tblIntermediateData> tblIntermediateData { get; set; }
        public virtual DbSet<tblMaterialParm> tblMaterialParm { get; set; }
        public virtual DbSet<tblTurbineParam> tblTurbineParam { get; set; }
        public virtual DbSet<tblVectorEstimate> tblVectorEstimate { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.windFarmId)
                .IsUnicode(false);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.turbineId)
                .IsUnicode(false);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.componentId)
                .IsUnicode(false);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.loadVectorType)
                .IsUnicode(false);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.speed)
                .HasPrecision(5, 2);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.angle)
                .HasPrecision(5, 2);

            modelBuilder.Entity<tblIntermediateData>()
                .Property(e => e.ti)
                .HasPrecision(5, 2);

            modelBuilder.Entity<tblMaterialParm>()
                .Property(e => e.windFarmId)
                .IsUnicode(false);

            modelBuilder.Entity<tblMaterialParm>()
                .Property(e => e.turbineId)
                .IsUnicode(false);

            modelBuilder.Entity<tblMaterialParm>()
                .Property(e => e.componentId)
                .IsUnicode(false);

            modelBuilder.Entity<tblMaterialParm>()
                .Property(e => e.m)
                .HasPrecision(8, 2);

            modelBuilder.Entity<tblMaterialParm>()
                .Property(e => e.del)
                .HasPrecision(20, 2);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.windFarmId)
                .IsUnicode(false);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.turbineId)
                .IsUnicode(false);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.turbineName)
                .IsUnicode(false);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.lng)
                .HasPrecision(10, 6);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.lat)
                .HasPrecision(10, 6);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.model)
                .IsUnicode(false);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.vender)
                .IsUnicode(false);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.powerRating)
                .HasPrecision(8, 2);

            modelBuilder.Entity<tblTurbineParam>()
                .Property(e => e.lifeCycleDesign)
                .HasPrecision(8, 3);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.wind_farm_id)
                .IsUnicode(false);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.turbine_id)
                .IsUnicode(false);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.component_id)
                .IsUnicode(false);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.load_vector_type)
                .IsUnicode(false);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.life_cycle_estimate)
                .HasPrecision(8, 3);

            modelBuilder.Entity<tblVectorEstimate>()
                .Property(e => e.life_left_estimate)
                .HasPrecision(8, 3);
        }
    }
}
